//
//  ApplyShowViewController.m
//  QXShowing
//
//  Created by 王道道 on 2018/4/20.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#define footPortrait_Height 80 *SizeScale


#import "ApplyShowViewController.h"

//#import "ApplyItemListViewController.h"
#import "NextStepViewController.h"
#import "SHowListTableViewCell.h"
#import "Title_TF_TableViewCell.h"
#import "MineFooterView.h"


static NSString *const listPhotoCell = @"listPhotoCell";
static NSString *const listTextCell = @"listTextCell";
static NSString *const listCell = @"listCell";


@interface ApplyShowViewController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation ApplyShowViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"填写资料";
    [self initNavBarBackBtn];
    
    [self setUpUI];
    
    self.showInfoArray = [[NSMutableArray alloc] initWithObjects:@"", @"", @"", @"", @"", nil];
}

- (void)setUpUI {
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, App_Frame_Width, App_Frame_Height) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.tableHeaderView = [[UIView alloc]init];
//    _tableView.tableFooterView = [[UIView alloc]init];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.scrollsToTop = NO;
    [self.view addSubview:_tableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITableViewDelegate,UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 0) {
        return 1;
    } else {
        return 4;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:listCell];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:listCell];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        cell.textLabel.text = @"参加展会";
        cell.detailTextLabel.text = self.showInfoArray[1];
        cell.textLabel.font = BHFont_Size_15;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
    } else {
        if (indexPath.row < 2) {
            Title_TF_TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:listTextCell];
            if (cell == nil) {
                cell = [[Title_TF_TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:listTextCell];
            }
            
            if (indexPath.row == 0) {
                cell.titleLabel.text = @"联系人：";
            } else {
                cell.titleLabel.text = @"联系人电话：";
            }
            return cell;
        } else {
            SHowListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:listTextCell];
            if (cell == nil) {
                cell = [[SHowListTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:listCell];
            }
            return cell;
        }
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        return 50.0;
    } else {
        if (indexPath.row == 0 || indexPath.row == 1) {
            return 50.0;
        } else {
            return 120.0;
        }
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    if (section == 0) {
        return 15.0;
    }
    else {
        return footPortrait_Height;
    }
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    if (section == 0) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, App_Frame_Width, 15.0)];
        view.backgroundColor = Bg_Color_EEEEEE;
        return view;
    }
    else {
//        UIView *view = [[UIView alloc] init];
//        return view;
        MineFooterView *footerView = [[MineFooterView alloc] initWithFrame:CGRectMake(0, 0, App_Frame_Width, footPortrait_Height)];
//        footerView.baseProtocol = self;
        return footerView;
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
//        ApplyItemListViewController *next = [[ApplyItemListViewController alloc] init];
        NextStepViewController *next = [[NextStepViewController alloc] init];
        next.title = @"地区选择";
        next.page = 1;
        next.chooseArray = [[NSMutableArray alloc] initWithObjects:@"", @"", @"", @"", @"", nil];
        [self pushViewController:next animated:YES];
    } else {
        
    }
}


@end
